<template>
  <!--视频详情 开始-->
  <div class="xgbddtl pubCon">
    <div class="pubicLoc">当前位置: <a href="/missworld/home">首页</a>&nbsp;&gt;&nbsp;视频集锦</div>
    <div class="xgbd bg1 nBox">
      <div class="artit">
        {{infoTile}}
      </div>
      <div class="artime" v-if="String(infoTime).length > 0">
        时间：{{timestampToTime(infoTime)}}
      </div>
      <div class="spcon">
        <!--<img :src="imageCover">-->
        <iframe frameborder='0' width="1100" height="640" marginheight='0' marginwidth='0' scrolling='no' :src='videoLink'></iframe>
      </div>
    </div>
  </div>
  <!--视频详情 结束-->
</template>

<script>
  export default {
    //数据
    data(){
      return {
        infoId:0,//视频id
        imageCover:'',//视频封面图
        imageVertical:'',//视频 竖形 封面图
        infoTile:'',//视频标题
        infoTime:'',//视频时间
        videoLink:'',//视频链接
      }
    },
    methods:{
      timestampToTime:function (timestamp) {
        var date = new Date(timestamp);//时间戳为10位需*1000，时间戳为13位的话不需乘1000
        var Y = date.getFullYear() + '-';
        var M = (date.getMonth()+1 < 10 ? '0'+(date.getMonth()+1) : date.getMonth()+1) + '-';
        var D = date.getDate() + ' ';
        var h = (date.getHours() < 10 ? '0' + date.getHours() : date.getHours()) + ':';
        var m = (date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes()) + ':';
        var s = date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds();
        return Y+M+D+h+m+s;
      },
    },
    created(){
      let _this = this;
      //将前面query带过来的 infoId 参数赋值给该组件定义的 tmpData 值
      _this.infoId= this.$route.query.infoId;

      //请求接口获取 新闻视频详情
      _this.$http.get('http://m.nsr.com.cn/xinsilu/v1/videoNsr/getVideoNsrById?id='+_this.infoId, {
        params: {}
      }).then(response => {
        if (response.data.code == 'R0000000') {
          _this.imageCover = response.data.data.imageCover;
          _this.imageVertical = response.data.data.imageVertical;
          _this.videoLink = response.data.data.videoLink;
          _this.infoTile = response.data.data.title;
          _this.infoTime = response.data.data.publishTime;
        }
      }, response => {
      });
    },
  }
</script>

<style scoped>

</style>
